package com.proxy.cglib;

import net.sf.cglib.reflect.ConstructorDelegate;

//为了对构造函数进行代理，我们需要一个接口，这个接口只含有一个Object newInstance(…)方法，用来调用相应的构造函数
public class ConstructorDelegateDemo {

	public static void main(String[] args) {
		SampleBeanConstructorDelegate constructorDelegate = (SampleBeanConstructorDelegate) ConstructorDelegate.create(
	            SampleBean.class, SampleBeanConstructorDelegate.class);
	    SampleBean bean = (SampleBean) constructorDelegate.newInstance("Hello world");
	    System.out.println(SampleBean.class.isAssignableFrom(bean.getClass()));
	    System.out.println(bean.getValue());
	}

}
